package macrochip.vison.com.gps.application;

import android.os.Environment;

import com.fh.lib.FHSDK;
import com.photoalbum.entity.Setting;
import com.vison.baselibrary.activity.VideoPlayFilterActivity;
import com.vison.baselibrary.base.BaseApplication;
import com.vison.baselibrary.utils.AppUtils;
import com.vison.baselibrary.utils.LogRecordUtils;
import com.vison.baselibrary.utils.ObjectUtils;

import java.io.File;
import java.util.Locale;

import macrochip.vison.com.gps.BuildConfig;
import macrochip.vison.com.gps.R;
import macrochip.vison.com.gps.manager.DataUtils;

public class MyApplication extends BaseApplication {

    public static MyApplication instance;

    @Override
    public void onCreate() {
        AppUtils.init(this);
        super.onCreate();
        instance = this;
        String appInfo = String.format("APP:%s APP version:%s", getString(R.string.app_name), BuildConfig.VERSION_NAME);
        LogRecordUtils.addLog(appInfo);
        initAlbum();
    }

    private void initAlbum() {
        Setting.getInstance().locale(Locale.getDefault()).mp4(VideoPlayFilterActivity.class);
    }

    public static MyApplication getInstance() {
        return instance;
    }



    @Override
    public void onTcpReceiveData(byte[] data) {
        super.onTcpReceiveData(data);

        String dataStr = ObjectUtils.bytesToHexString(data);;
        if (dataStr.startsWith("fffe")) {
            DataUtils.visonGps(analysisListener, data);
        }
    }

}